solving equations using determinant method